<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>考场安排</title>
    <link href="../../static/css/bootstrap.min.css" rel="stylesheet" th:href="@{/static/css/bootstrap.min.css}">
    <link href="../../static/css/dashboard.css" rel="stylesheet" th:href="@{/static/css/dashboard.css}">
</head>
<body>
<div th:insert="admin/common::topbar"></div>
<div class="container-fluid">
    <div class="row">
        <!--侧边栏-->
        <div th:insert="~{admin/common::sidebar(active='examArrange.html')}">
        </div>
        <main class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4" role="main">
            <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
                <h3>考场监考安排</h3>
                <div class="btn-toolbar mb-2 mb-md-0">
                    <div class="btn-group mr-2">
                        <!--<form id="form" th:action="@{#}" method="post">
                            &lt;!&ndash;onblur 失去焦点产生事件&ndash;&gt;
                            <div class="input-group">
                                <select class="form-control" name="exam_id" id="exam_id">
                                    <option th:selected="${examById.getExam_id()==exam.getExam_id()}"  th:each="exam:${examList}" th:text="${exam.getExam_name()}" th:value="${exam.getExam_id()}">
                                    </option>
                                </select>
                                <input class="input-group-addon btn btn-sm btn-primary" type="submit" value="搜索">
                            </div>
                        </form>-->
                        <button class="btn btn-primary btn-sm btn-outline-secondary" id="btn-exam-info">考场详情</button>
                        <button class="btn btn-primary btn-sm btn-outline-secondary" id="btn-exam-arrange">考试详情</button>

                    </div>
                    <div class="btn-group mr-2">
                        <button class="btn btn-primary btn-sm btn-outline-secondary" id="btn-admin">管理员</button>
                        <button class="btn btn-sm btn-outline-secondary" id="btn-student">学生端</button>
                    </div>
                </div>
            </div>
            <div class="table-responsive">
                <table class="table table-striped table-sm">
                    <thead style="background-color: #00d0ff">
                    <tr>
                        <th style="color: #AB9C08">考试编号</th>
                        <th style="color: #067D14">考试名称</th>
                        <th style="color: #00f729">考试科目编号</th>
                        <th style="color: #AB9C08">考试科目</th>
                        <th style="color: #7dab08">考试地点</th>
                        <th style="color: #3eab08">主考官</th>
                        <th style="color: #08ab9d">副考官</th>
                        <th style="color: #ab5f08">考试监考人员安排</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr class="examPlaceList" th:each="examInfo:${examInfoList}">
                        <th th:text="${examInfo.getExam_id()}"></th>
                        <th th:text="${examInfo.getExam_cname()}"></th>
                        <th th:text="${examInfo.getExam_cid()}"></th>
                        <th th:text="${examInfo.getExam_name()}"></th>
                        <th th:text="${examInfo.getExam_place()}"></th>
                        <th th:style="${examInfo.getTid_first()==''||examInfo.getTid_first()==null}?'color: red':'color: #3eab08'"
                            th:text="${examInfo.getTid_first()==''||examInfo.getTid_first()==null?'未安排':examInfo.getTname_first()}"></th>
                        <th th:style="${examInfo.getTid_second()==''||examInfo.getTid_second()==null}?'color: red':'color: #08ab9d'"
                            th:text="${examInfo.getTid_second()==''||examInfo.getTid_second()==null?'未安排':examInfo.getTname_second()}"></th>
                        <th>
                            <!--  <button th:value="${examInfo.getExam_cid()}" style="color: #899443" class="btn btn-sm  btn-outline-secondary ">考试时间安排</button>-->
                            <button class="btn btn-sm  btn-outline-secondary " style="color: #899443"
                                    th:value="${examInfo.getExam_cid()}">考场监考人员安排
                            </button>

                        </th>
                    </tr>
                    </tbody>
                </table>
            </div>
        </main>
    </div>
</div>
<script src="../../static/js/jquery-3.6.0.min.js" th:src="@{/static/js/jquery-3.6.0.min.js}"
        type="text/javascript"></script>
<script src="../../static/js/bootstrap.min.js" th:src="@{/static/js/bootstrap.min.js}" type="text/javascript"></script>
<script src="../../static/js/btn.js" th:src="@{/static/js/btn.js}"></script>
<script>
    let exam_id = [[${exam_id}]];
    $('#btn-exam-info').click(function () {
        $(location).attr('href', '/admin/showExamList/' + exam_id + '/' + 1);
    })
    $('#btn-exam-arrange').click(function () {
        $(location).attr('href', '/admin/getExamSubjectList/' + exam_id);
    })
    $('.examPlaceList').each(function () {
        let exam_place = $(this).children().eq(4).text();
        let arrange = $(this).children().eq(7).children();
        let exam_cid = arrange.val();
        arrange.click(function () {
            $(location).attr('href', '/admin/toArrangeTeacher/' + exam_id + '/' + exam_cid + '/' + exam_place);
        })

    })
</script>
</body>
</html>